$("input").click(function(){
    var name=$(this).attr("name");
    $(".text_msg").css("display","none");
    $("#"+name+"_msg").css("display","inline");
})
/* 姓名的验证*/
$("#name").change(function(){
    var name = $(this).val();
    $.ajax({
        type:"get",
        url:"index.php?m=admin&c=admin&a=checkName",
        data:{name:name},
        success:function(data){
           $("#name_msg").html(data);
        }
    });
});

/* 手机号的验证*/
$("#tel").change(function(){
    var tel = $(this).val();
    $.ajax({
        type:"get",
        url:"index.php?m=admin&c=admin&a=checkTel",
        data:{tel:tel},
        success:function(data){
           $("#tel_msg").html(data);
        }
    });
});
/* admin的注册*/
$(".button").click(function(){
    var name = $("#name").val();
    var pwd = $("#pwd").val();
    var tel = $("#tel").val();
    $.ajax({
        type:"get",
        url:"index.php?m=admin&c=admin&a=addAdmin",
        data:{name:name,pwd:pwd,tel:tel},
        success:function(data){
           if(data==true){
               alert("注册成功");
           }else{
               alert("注册失败");
           }
        }
    });
});
/* admin的修改*/
$(".tijiao").click(function(){
    var id = $("#id").val();
    var name = $("#name").val();
    var pwd = $("#pwd").val();
    var tel = $("#tel").val();
    $.ajax({
        type:"get",
        url:"index.php?m=admin&c=admin&a=checkupdateAdmin",
        data:{id:id,name:name,pwd:pwd,tel:tel},
        success:function(data){
           if(data==true){
               alert("成功");
           }else{
               alert("失败");
           }
        }
    });
});
/* admin的删除*/
$(".delete1").click(function(){
    var delete1 = $(this).attr("name");
        $.ajax({
            type:"get",
            url:"index.php?m=admin&c=admin&a=deleteAdmin",
            data:{delete1:delete1},
            success:function(data){
                if(data==true){
                    alert("删除成功");
                     history.go(0);
                }else{
                    alert("删除失败");
                }
        }
    });
});
/* user1的删除*/
$(".delete2").click(function(){
    var delete2 = $(this).attr("name");
        $.ajax({
            type:"get",
            url:"index.php?m=admin&c=user1&a=deleteUser1",
            data:{delete2:delete2},
            success:function(data){
                if(data==true){
                    alert("删除成功");
                     history.go(0);
                }else{
                    alert("删除失败");
                }
        }
    });
});

